using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using MvcShop.Core.Architecture.IoC;
using MvcShop.MVC.Test;
using MvcShop.Core.Architecture.Configuration;
using Castle.Windsor.Installer;
using System.Configuration;
using MvcShop.MVC.Handlers.Resources;
using MvcShop.Models.ViewDataModels;
using MvcShop.MVC.Filters;
using MvcShop.Models.Repositories;

namespace MvcShop.MVC.Controllers
{
    public class TestController : Controller
    {
        //
        // GET: /Test/
        public ActionResult Index()
        {
            ILog log = (ILog)MvcApplication.Container["txtLog"];
            ViewData["log"] = log.Write("yeaszi ");

            HttpContextBase context = this.HttpContext;
           
            ResourcesHandler rh = new ResourcesHandler();
            rh.ProcessRequest(context);
            //ViewData["Resources"] = sg.ToString();

            List<ProductList> pl = new List<ProductList>();
            for(int i=1;i<11;i++){
                pl.Add(new ProductList { ProductId = i, ProductName = "yeaszi text"+i.ToString() });
            }

            HttpCookie cookies = new HttpCookie("ProductList");
            foreach (var p in pl)
            {
                cookies.Values[p.ProductId.ToString()] = p.ProductId.ToString() + "@" + p.ProductName;
            }
            Response.Cookies.Add(cookies);

            return View();
        }

        public ActionResult CR()
        {
            ICriteria c;
            c = new EqualCriteria("A", "a");
            c = c.And(new EqualCriteria("B", "b"));

            return Content(c.Expression);
        }
    }
}
